<html>
<head>
</head>
<body>
Checking new version of VLOOK™ ...
<div id="check-result"></div>
<script type="text/javascript">
let latestVer = "V28.1";
window.addEventListener('message', function(event) {
    // 处理消息
    let receMessage = event.data;
        // resultDiv = document.getElementById("check-result");
    // 校验消息合法性
    if (typeof receMessage !== "string")
        return;
    if (!receMessage.startsWith("V") || receMessage.length > 6)
        return;

    // resultDiv.innerText += `\nLastest version [${latestVer}]`;
    // resultDiv.innerText += `\nChecking update for [${receMessage}] ...`;

    // 来源的版本
    srcVer = receMessage.substring(1, receMessage.length);
    srcVer = isNaN(srcVer) ? 0 : parseFloat(srcVer);
    // 当前最新版本
    latestVer = latestVer.substring(1, latestVer.length);
    latestVer = isNaN(latestVer) ? 0 : parseFloat(latestVer);

    // 生成结果
    let result = latestVer > srcVer ? "yes" : "no";
    // resultDiv.innerText += "\n[" + result + "]";

    // 回复消息
    event.source.postMessage("chk-update:" + result
        + ((srcVer < 27) ? "" : ",latest:" + latestVer), // 27.0+ 的新格式内容
        event.origin || "*");
});
</script>
</body>
</html>
